[−][src]Crate ethkey
Ethereum keys management supporting keystores in formats used by geth (soon), parity and pyethereum.
Features
- random key pair generation
- key serialization/deserialization
- keystore password change
- signing and verification
Usage
[dependencies]
ethkey = "0.3"
Example
ⓘThis code runs with edition 2018
use ethkey::prelude::*; fn main() { let key = EthAccount::load_or_generate("/tmp/path/to/keystore", "passwd") .expect("should load or generate new eth key"); println!("{:?}", key.address()); let message = [7_u8; 32]; // sign the message let signature = key.sign(&message).unwrap(); // verify the signature let result = key.verify(&signature, &message).unwrap(); println!("{}", if result {"verification ok"} else {"wrong signature"}); }
Modules
prelude | A "prelude" for users of the |
Structs
Address | Ethereum address |
EthAccount | An Ethereum Account keys with store.
Allows to generate a new key pair and save it to disk as well as read existing keyfile.
Provides |
PublicKey | Represents public part of the Ethereum key. |
SecretKey | Represents the private part of the Ethereum key |
Signature | Message signature |
Enums
Error |
Constants
KEYSTORE_VERSION | |
KEY_ITERATIONS | HMAC fn iteration count; a compromise between security and performance |
Type Definitions
Message | 32 bytes Message for signing and verification |
Password | Password. It is overwritten with zeros after memory is released. |
Result |